﻿using MediatR;
using SU.Center.Domain.SY;
using SU.Center.Infa;

namespace SU.Center.Api.Handler.TraceabilityMethod
{
    /// <summary>
    /// 显示产品
    /// </summary>
    public class GetProductHandler:IRequestHandler<GetProductReqsultDto, ApiResult>
    {
        private readonly ILogger<GetProductHandler> logger;
        private readonly IBaseReposiotry<Product> baseReposiotry;

        public GetProductHandler(ILogger<GetProductHandler> logger, IBaseReposiotry<Product> baseReposiotry)
        {
            this.logger = logger;
            this.baseReposiotry = baseReposiotry;
        }

        public async Task<ApiResult> Handle(GetProductReqsultDto request, CancellationToken cancellationToken)
        {
            var list = await baseReposiotry.GetAll();
            return ApiResult.Ok(list);
        }
    }
}

public class GetProductReqsultDto:IRequest<ApiResult>
{

}
